package com.rxyb.rabbitmq.test;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author YJH
 * @version 1.0
 * @description 消费者
 * @date 2020/6/1  15:22
 */
@Component
public class ConsumerReceiver {


    /**
     * 直流
     *
     * @param testMessage
     */
    @RabbitListener(queues = "TestDirectQueue")
    public void process(String testMessage) {
        System.out.println("DirectReceiver消费者收到消息  : " + testMessage);
    }


    @RabbitListener(queues = "topic.man")
    public void topicMan(String testMessage) {
        System.out.println("topic.man消费者收到消息  : " + testMessage);
    }

    @RabbitListener(queues = "topic.woman")
    public void topicWoMan(String testMessage) {
        System.out.println("topic.woman消费者收到消息  : " + testMessage);
    }


    /*******************扇形交换机*********************************/

    @RabbitListener(queues = "fanout.C")
    public void fanoutC(String testMessage) {
        System.out.println("fanout.C消费者收到消息  : " + testMessage);
    }

    @RabbitListener(queues = "fanout.A")
    public void fanoutA(String testMessage) {
        System.out.println("fanout.A消费者收到消息  : " + testMessage);
    }

    @RabbitListener(queues = "fanout.B")
    public void fanoutB(String testMessage) {
        System.out.println("fanout.B消费者收到消息  : " + testMessage);
    }

}
